package com.richard.base.view

import android.content.Context
import android.util.AttributeSet
import android.view.MotionEvent
import android.widget.RelativeLayout

/**
 ***************************************
 * 项目名称:Giggle
 * @Author wuzhiguo
 * 邮箱：wuzhiguo@ksjgs.com
 * 创建时间: 2020/7/28     7:55 PM
 * 用途:
 ***************************************
 */

class PressScaleRelative : RelativeLayout {

    @JvmOverloads constructor(
        context: Context? = null,
        attrs: AttributeSet? = null,
        defStyleAttr: Int = 0
    ) : super(context, attrs, defStyleAttr)

    override fun onTouchEvent(event: MotionEvent): Boolean {
        when (event.action) {
            MotionEvent.ACTION_DOWN -> {
                scaleX = 1.2f
                scaleY = 1.2f
            }
            MotionEvent.ACTION_UP -> {
                scaleX = 1f
                scaleY = 1f
            }
        }
        return super.onTouchEvent(event)
    }
}
